class User < ActiveRecord::Base
  validates_uniqueness_of :username
  validates_confirmation_of :password, :on => :create, :message => "passwords do not match"
  validates_length_of :password, :within => 6..12
  has_one :profile, :class_name => 'Profile', :foreign_key => "owner_id"
  
  def self.authenticate(user_info)
    find_by_username_and_password(user_info[:username], user_info[:password])
  end
end
